home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / DOCS / AMOSDOC.LHA / AmosHyperBook.dms / in.adf / Compiler / ALLIANCE-11 / ALLIANCE-11
Encoding:
Text File  |  1992-03-21  |  4.4 KB  |  107 lines

  1.  
  2.  
  3. CHAPTER 11: RUNNING A COMPILED PROGRAM
  4. There are three possibilities:
  5.  
  6. WORKBENCH PROGRAMS
  7. If you compiled your programs using the WB option, you will be able to
  8. execute it straight from the Workbench by simply clicking on the
  9. appropriate icon with the mouse.  As the program is loading, the mouse
  10. pointer will flicker continuously.  Don't worry if the process takes
  11. several seconds.  AMOS is simply unsquashing the various system routines.
  12. WARNING! If you click on the icon twice, you could launch another copy of
  13. the same program!
  14.  
  15. CLI PROGRAMS
  16. These programs are created when you select the CLI option from the compiler
  17. accessory.  They can be executed from the CLI by just typing their name.
  18. For example:
  19.  
  20.      1>demo
  21.  
  22. This runs a program called demo from the current disk.  If the program you
  23. wish to run is on another drive, you'll need to include the current
  24. pathname like so:
  25.  
  26.      1>Df1:demo
  27.  
  28. The Amiga treats CLI programs exactly like any other machine code program,
  29. so they can be called from within batch files or executed automatically on
  30. startup.  See 'CREATING AN AUTOBOOT DISK' for more details.
  31.  
  32. Normally, AMOS will generate a standard screen for your graphics.  This can
  33. be suppressed with the -S0 option during compilation.  You can also include
  34. parameters.  These will be automatically loaded into the reserved variable
  35. COMMAND LINE$ when your program is initialised.  For example:
  36.  
  37.      1> demo test
  38.  
  39. executes a compiled demo program called 'Test'.  When the program begins
  40. the parameter test will be placed into the string COMMAND LINE$.
  41.  
  42. AMOS RUNNABLE PROGRAMS
  43. These programs can be run directly from the AMOS Basic interpreter, and are
  44. usually around 40k smaller than the equivalent CLI or Workbench versions.
  45. If you've a megabyte or more of RAM, you'll often be able to hold both the
  46. interpreted and compiled versions of the program in memory.  This will
  47. speed up your development process enormously.
  48.      In order to make use of this feature, you first need to compile your
  49. programs in a special .AMOS format.  This can be accomplished from the
  50. compiler accessory by setting the Type icon to AMOS.  You can now load your
  51. compiled programs and run them straight from the editor.  The editor window
  52. will contain the following lines:
  53.  
  54.      Set Buffer n:Rem where N is the current size of the variable area
  55.      Proc_Complied
  56.      Procedure_Compiled
  57.  
  58. The procedure_COMPILED is locked and contains your compiled programs.  Note
  59. that the above program definition is taken from a file called
  60. Header_AMOS.AMOS in the AMOS.System folder.  You can edit this file to
  61. change the name of the compiled procedure to something more exiting.  For
  62. example:
  63.  
  64.      Set Buffer 8
  65.      Proc Amosteriods
  66.      Procedure Amosteriods
  67.  
  68. WARNING! The procedure definition contained by the header holds a special
  69. instruction used to execute the compiled program.  This should be left
  70. exactly as it stands.  If you try to run the header program from the
  71. interpreter .AMOS will immediately crash!
  72.      The compiled program is stored in the editor buffer, and is treated
  73. just like any normal AMOS program.  All memory banks are in the standard
  74. format and can be loaded, saved or grabbed as required.  You can even
  75. execute a compiled program as an accessory.  As an example, try compiling
  76. the new sprite editor on the AMOS compiler disk.  Not only is there a
  77. noticeable increase in the execution speed, but the testing process is
  78. instantaneous.
  79.  
  80. EXITING FROM A COMPILED PROGRAM
  81. The compiled program will automatically return you to the calling
  82. environment after it has completed successfully.  You can however, abort
  83. from the program at any time by holding down the Control and C keys.
  84.  
  85. ERROR MESSAGES
  86. If you've compiled your program with the 'include error messages' or -E1
  87. option from the command line, a standard AMOS error message will be
  88. displayed when something goes wrong.  The format naturally depends on the
  89. environment you are using:
  90.  
  91. WORKBENCH
  92. The message will be displayed in a small alert box.
  93.  
  94. CLI
  95. The error will be returned in the form of a normal CLI message.
  96.  
  97. AMOS
  98. The error will be indicated on the INFO line of the AMOS Editor.
  99.  
  100. Note that the error messages are exactly the same as the interpreted
  101. versions, except that there are no line numbers.  If you want to find the
  102. exact position at which the error ocurred, you'll need to test the original
  103. interpreted program from within AMOS Basic.  If you've omitted the error
  104. messages, your program will simply quit and return in the event of an
  105. error.
  106.  
  107.